package com.gdk.ksoft.ui.customers;

import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.EditText;

import com.gdk.ksoft.R;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;

/**
 * 添加客户联系人页面
 */
public class NewContractorActivity extends Activity {

    @ViewInject(R.id.pnewContractor_etName)private EditText etName;//客户名称
    @ViewInject(R.id.pnewContractor_etJob)private EditText etJob;//职务
    @ViewInject(R.id.pnewContractor_etPhone)private EditText etPhone;//电话
//    @ViewInject(R.id.pnewContractor_gpSex)
    @ViewInject(R.id.pnewContractor_etNotice)private EditText etNotice;//备注信息

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_new_contractor);
        ViewUtils.inject(this);
    }

    @OnClick(value={R.id.pnewContractor_txtSubmit,R.id.pnewContractor_txtCancel})
    public void onViewClick(View view){
        switch(view.getId()){
            case R.id.pnewContractor_txtSubmit:
                break;
            case R.id.pnewContractor_txtCancel:
                goBack();//页面返回
                break;
        }
    }

    /**
     * 页面返回
     */
    public void goBack() {
        this.finish();
        overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
    }

    @OnClick(value = {R.id.pnewContractor_imgBack})
    public void OnBackClick(View view) {
        goBack();//页面返回
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_BACK) {
            goBack();//页面返回
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }

}
